<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<ul id="riskTab" class="contListTab mt10">
    <li class="selectContListTab"><a href="javascript:void(0);">Home Ad</a></li>
</ul>
<div id="riskTabCnt">
	<div class="pad10">
	    <table class="listTable tac mar10">
            <thead>
                <tr>
                    <th width="200px;">Pos</th>
                    <th>Image File</th>
                    <th>Image Preview</th>
                    <th>Link</th>
                    <th>Operation</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td>Ad 1.</td>
                    <td>
                        <div style="width:315px; margin:0 auto;overflow:hidden;zoom:1;">
	                        <form method="POST" enctype="multipart/form-data" id="ad1ImageForm"> 
	                            <input type="hidden" name="filePath" value="file/homeAd"/>
			                    <input type="hidden" name="width" value="976"/>
			                    <input type="hidden" name="height" value="305"/>
		                    	<input type="file" name="file" id="file" onchange="javascript:$('#ad1ImageForm').submit();"/>
	                    	</form>
                    	   <font color="red">Image Size: 976 x 305</font>
                    	</div>
                        <input type="hidden" id="ad1FilePath"/>
                    </td>
                    <td>
                        <img src="" id="ad1Image" style="width: 448px; height: 140px; margin: 5px 0pt;" />
                    </td>
                    <td>
                        <input type="text" class="input_txt" size="30" id="ad1Link" maxlength="100"/>
                    </td>
                    <td>
                    	<input type="button" onclick="javascript:advertisement.create(1,$('#ad1FilePath').val(),$('#ad1Link').val());" value="Save" class="blueBtn"/>
                    </td>
                </tr>
                <tr class="grayTd">
                    <td>Ad 2.</td>
                    <td>
                        <div style="width:315px; margin:0 auto;overflow:hidden;zoom:1;">
	                        <form method="POST" enctype="multipart/form-data" id="ad2ImageForm"> 
	                            <input type="hidden" name="filePath" value="file/homeAd"/>
			                    <input type="hidden" name="width" value="976"/>
			                    <input type="hidden" name="height" value="305"/>
	                            <input type="file" name="file" id="file" onchange="javascript:$('#ad2ImageForm').submit();"/>
	                        </form>
	                        <font color="red">Image Size: 976 x 305</font>
                        </div>
                        <input type="hidden" id="ad2FilePath"/>
                    </td>
                    <td>
                        <img src="" id="ad2Image" style="width: 448px; height: 140px; margin: 5px 0pt;" />
                    </td>
                    <td>
                        <input type="text" class="input_txt" size="30" id="ad2Link" maxlength="100"/>
                    </td>
                    <td>
                    	<input type="button" onclick="javascript:advertisement.create(2,$('#ad2FilePath').val(),$('#ad2Link').val());" value="Save" class="blueBtn" />
                    </td>
                </tr>
                <tr>
                    <td>Ad 3.</td>
                    <td>
                        <div style="width:315px; margin:0 auto;overflow:hidden;zoom:1;">
	                        <form method="POST" enctype="multipart/form-data" id="ad3ImageForm"> 
	                            <input type="hidden" name="filePath" value="file/homeAd"/>
			                    <input type="hidden" name="width" value="976"/>
			                    <input type="hidden" name="height" value="305"/>
	                            <input type="file" name="file" id="file" onchange="javascript:$('#ad3ImageForm').submit();"/>
	                        </form>
	                        <font color="red">Image Size: 976 x 305</font>
                        </div>
                        <input type="hidden" id="ad3FilePath"/>
                    </td>
                    <td>
                        <img src="" id="ad3Image" style="width: 448px; height: 140px; margin: 5px 0pt;" />
                    </td>
                    <td>
                        <input type="text" class="input_txt" size="30" id="ad3Link" maxlength="100"/>
                    </td>
                    <td>
                    	<input type="button" onclick="javascript:advertisement.create(3,$('#ad3FilePath').val(),$('#ad3Link').val());" value="Save" class="blueBtn" />
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>

<script type="text/javascript" src="js/advertisement.js"></script>
<script type="text/javascript" src="js/upload.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	advertisement.list();
	
    upload.uploadImage('ad1');
    upload.uploadImage('ad2');
    upload.uploadImage('ad3');
});
</script>
